<!doctype html>
<html>
{include file="head.html"}
<style>
.none{display:none;}
</style>
<body>
<script>
var qsjia={$shop.qsjia};
</script>
  <div class="fullscreen">
  <div class="scroll_content">
    <div class="topfixed">
      <div class="t_left"><a href="/index.php" class="goBack"><i class="back"></i></a></div>
      <div class="t_main"  >{$shop.title}</div>
      <div class="t_right"><a href="/index.php?m=ymdian&a=loudong" class="link">选楼栋</a></div>

    </div>
    <div class="paddingheight"></div>
	 <div class="flexslider">
      {get data=ad1 model=ad fun=listbyno("wap_ymdian_flash")}
          <ul class="slides clearfix">
          {foreach item=c from=$ad1}
            <li><a href="{$c.link1}"><img class="img lazy" url="{$c.imgurl|images_site}" width="100%"></a> </li>
          {/foreach}  
           
          </ul>
    </div>
 
    <div class="product_sendbox clearfix">
      <div class="fl">{$shop.shsj}分钟<br>
        送货到寝 </div>
      <div class="fr">{$shop.qsjia}元<br>起送</div>
      <div class="time">营业时间：<b class="red">{$shop.yystart}-{$shop.yyend}</b></div>
    </div>
    {include file="inc/shop_gonggao.html"}
    <div id="posNav">
    <style>
    .global_tabs.i4 li{width:24.6%;}
    </style>
    <ul class="global_tabs clearfix " >
    {foreach item=c key=key from=$catlist}	
      <li class="{if $key eq 1}first  cur{elseif $key eq 3}last{/if}" to="list{$key}"><a href="#list{$key}">{$c}</a></li>
    {/foreach}   
     
    </ul>
    </div>
    {get data=products model=ymdian_product fun=lsitByShopCat("$shop.id")}
    {get data=cart model=ymdian_order_cart fun=getListByUser(" AND shopid=$shop.id")}
    <div class="product_list" id="product_list">
       <ul class="list  clearfix">
      	{foreach item=cc key=k from=$products}
		{if empty($cc)}
        <li  id="list{$k}" style="display:block;width:0px; height:0px; float:left;"></li>
        {/if}       
        {foreach item=c key=kk from=$cc}
        <li class="cat{$k} li">
          <p class="imgResize"><a href="javascript:;"><img url="{$c.imgurl|images_site}" class="img lazy"></a></p>
          <p class="tit">{$c.title} {if $kk eq 0}<span id="list{$k}" style="display:block;width:1px; height:1px; float:left;"></span>{/if}</p>
          <div class="num"><span class="fl"><del>￥{$c.market_price}</del></span><span class="fr">已售{$c.buy_num}份</span></div>
          <div class="pricebox">
            <div class="price"><b class="red">￥{if $c.lower_price>0}{$c.lower_price}{else}{$c.price}{/if}</b></div>
            <div class="showcart">
            {if $c.total_num <= 0}
            已售罄
            {else}
              <div class="cart_icon {if $cart[product][$c[id]]}none{/if}"></div>
              <div class="cart_num" {if $cart[product][$c[id]]} style="display:block;"{/if} object_id="{$c.id}" shopid="{$c.shopid}" productid="{$c.productid}">
              <a class="Decrease" href="javascript:void(0)"><i>-</i></a>
              <input class="Amount" value="{$cart[product][$c[id]][amount]|intval}" autocomplete="off" maxlength="3">
              <a class="Increase" href="javascript:void(0)"><i>+</i></a>
         	</div>
            {/if}
            </div>
          </div>
        </li> 
        
        
        
        {/foreach}
        
          {/foreach}
      </ul>
    </div>
 
    
    
  </div>
</div>

 <div class="bottom_cartfixed">
  <div class="cart " > <i id="end"></i> </div>
  <div class="info" id="shopCart"> 您一共添加了<span class="num" id="cart_num">{$cart.total_num|intval}</span> 件商品<br>
    合计：<b class="num" id="cart_total_money">{$cart.total_money|intval}</b>元 
     
    </div>
    
    <a href="javascript:;" style="{if $cart.total_money > $shop.qsjia} display:none{/if}" id="shop_lt_qsjia" class="btn">{$shop.qsjia}元起送</a>
    
    <a href="/index.php?m=cart"  style="{if $cart.total_money <= $shop.qsjia} display:none{/if}" id="shop_gt_qsjia" class="btn">去结算</a>
    
    
    
</div>
<div id="flyItem" class="fly_item" ><img class="lazy" url="{$skins}img/profile-80.jpg" width="40" height="40"></div>
<script src="{$skins}js/parabola.js"></script>
<script src="{$skins}js/ymdian_cart.js"></script>
<style>
.fix{position:fixed;top:50px; left:1px; right:0px;}
.fix  .global_tabs{margin:0 auto;}
.fix li{background-color:#fff; }
</style>
<script>
imgLazy("body");
loadjs(basejs,function(){
		 $(".flexslider").flexslider();
}) 
// 元素以及其他一些变量
var eleFlyElement = document.querySelector("#flyItem"), eleShopCart = document.querySelector("#shopCart");
 
// 抛物线运动
var myParabola = funParabola(eleFlyElement, eleShopCart, {
	speed: 400, //抛物线速度
	curvature: 0.0008, //控制抛物线弧度
	complete: function() {
		eleFlyElement.style.visibility = "hidden";
		
	}
});

var fix=0;
var show=1;
var lastTop=0;
var it;
var it_i=0;

 
 
function scrollNavFix(){
	var st=$(window).scrollTop();
	console.log(st);
	if(st==lastTop){
		return false;
	}
	lastTop=st;
	var winH=$(window).height();
	var H1=$("#list1").offset().top - st;
	var H2=$("#list2").offset().top - st;
	var H3=$("#list3").offset().top - st;
	
	if(H1>50 && H1<winH){
		show=1;
	}else if(H2>50 && H2<winH){
		show=2;
		console.log(show);
	}else if(winH>H3 && H3>100){
		show=3;
	}
	
	$(".global_tabs li").removeClass("cur");
	$(".global_tabs li").eq((show-1)).addClass("cur");
	if(st>50){
		if(fix==0){
			$("#posNav").addClass("fix");
			fix=1;
		}
		
	}else{
		if(fix==1){
			$("#posNav").removeClass("fix");
			fix=0;
		
		}
		
	}
}

$(window).scroll(function(e){
	scrollNavFix();
})
imgResize(240,240);
 $(window).resize(function(){
	 imgResize(240,240);
 })
//选项卡
$(".global_tabs li").click(function(e) {
    $(this).addClass("cur").siblings().removeClass("cur");
	/*
	$("#product_list .list").addClass("none");
	$("#"+$(this).attr("to")).removeClass("none");
	*/
});
//
$("#product_list .list:eq(0) .li:odd").css("margin-left","2%");
$("#product_list .list:eq(1) .li:odd").css("margin-left","2%");
$("#product_list .list:eq(2) .li:odd").css("margin-left","2%");
//购物车，显示加减模板
$(".product_list .cart_icon").click(function(e) {
	
    $(this).fadeOut(10).next(".cart_num").fadeIn("fast");
	$(this).parents(".showcart").find(".Increase").trigger("click");
});
</script>

 

 {include file="footer.html"} 
</body>
</html>
